#region Namespace References

using System.Collections.Generic;
using DynConDevCorp.OpenArch.SmartData.Interfaces;

#endregion

namespace DynConDevCorp.OpenArch.SmartData.Interfaces
{
    /// <summary>
    /// Base Interface for collections of ISmartField objects.
    /// </summary>
    public interface ISmartFieldCollection : ISmartCollection, ISmartField
    {
        #region Public Instance Methods

        /// <summary>
        /// Gets Item as the Specified Index.
        /// </summary>
        /// <typeparam name="TReturn">
        /// The type of the Item to return.
        /// This must be derived from ISmartField, but is provided to allow for cleaner syntax than explicit casting.
        /// </typeparam>
        /// <param name="index">The index.</param>
        /// <returns>The item with at the specified index></returns>
        TReturn GetFieldItem<TReturn>(int index) where TReturn : ISmartField;

        /// <summary>
        /// Gets the field items.
        /// </summary>
        /// <typeparam name="TReturn">
        /// The type of the Item to return.
        /// This must be derived from ISmartField, but is pprovided to allow for cleaner syntax than explicit casting.
        /// </typeparam>
        /// <returns></returns>
        IEnumerable<TReturn> GetFieldItems<TReturn>() where TReturn : ISmartField;

        #endregion
    }

    /// <summary>
    /// Type Safe Interface for collections of ISmartField objects.
    /// </summary>
    /// <typeparam name="TItem">
    /// The type of the item contained in the collection. 
    /// Must be derived from ISmartField.
    /// </typeparam>
    public interface ISmartFieldCollection<TItem> : ISmartFieldCollection
        where TItem : ISmartField
    {
        #region Public Instance Methods

        /// <summary>
        /// Gets Item as the Specified Index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>The item with at the specified index></returns>
        TItem GetFieldItem(int index);

        /// <summary>
        /// Gets the field items.
        /// </summary>
        /// <returns></returns>
        IEnumerable<TItem> GetFieldItems();

        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        void Add(TItem item);

        /// <summary>
        /// Removes the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        bool Remove(TItem item);

        /// <summary>
        /// Determines whether [contains] [the specified item].
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>
        /// 	<c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.
        /// </returns>
        bool Contains(TItem item);

        #endregion
    }
}